#include "Tictactoe.h"
#include "console.h"
#include<conio.h>
using namespace Course;

Tictactoe::Tictactoe()
{
	for(int i=0; i<3; i++)
	{
		for(int j=0; j<3; j++)
			this->board[i][j]= ' ';
	}

	Console::set_console_title("Tic Tac Toe");
	r=c=1;
}

void Tictactoe::print()
{


	for(int i=0; i<3; i++)
	{
		Console::gotoxy(0, i*2+0);
		cout << " _________" << endl;
		Console::gotoxy(0, i*2+1);
		for(int j=0; j<3; j++)
		{
			
			cout << "| " << this->board[i][j] ;
		}
		cout << "|\n";
	}
	Console::gotoxy(0, 4);
	cout<< " _________" << endl;

}

void Tictactoe::playTheGame()
{
	int z;

	while ( (z=getch()) != 'q' )
	{
		if ( z == '6' )
		{
			c++;
		}
		print();
		Console::gotoxy(c=3,r=3);
	}
}